<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function mySort(arr){
            var length = arr.length;
            var minindex = null;
            for(var i=0; i<length-1;i++){
                minindex = i;
                for(var j=i;j<length;j++){
                    if(arr[minindex]>arr[j]){
                        minindex = j;
                    }
                }
                if(minindex != i){
                    var temp=arr[i];
                    arr[i]=arr[minindex];
                    arr[minindex]=temp;
                }
            }
            return arr;
        }
        var arr=[2,5,9,5,4,3,6,99,6,5,22,26456,6]
        console.log(mySort(arr))
    </script>
</body>
</html>